home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / u_man / cat1 / X11 / xmon.z / xmon
Encoding:
Text File  |  2001-04-17  |  22.0 KB  |  529 lines

  1.  
  2.  
  3.  
  4.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           xmon - interactive X protocol monitor
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           xxxxmmmmoooonnnnuuuuiiii [ ooooppppttttiiiioooonnnnssss ] | xxxxmmmmoooonnnndddd [ ooooppppttttiiiioooonnnnssss ]
  13.  
  14.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.           Xmon interactively monitors the byte-stream connections
  16.           between an X server and a number of X clients. Xmon
  17.           recognizes all requests, events, errors and replies sent
  18.           between the clients and the server which are part of the
  19.           core X protocol. The contents of these messages are
  20.           displayed on standard output at a user settable degree of
  21.           detail from none to every bit and byte. Xmon also allows the
  22.           user to select a number of requests or events to be
  23.           monitored at a different degree of detail.  Xmon will also
  24.           block the transmission of selected requests from the clients
  25.           to the server and selected events from the server to the
  26.           clients. Xmon also keeps statistics of the number of
  27.           requests, events, and errors received.
  28.  
  29.           Xmon is made up of two separate processes. The core of xmon
  30.           is xmond which monitors the X protocol streams and displays
  31.           the protocol messages on standard output. The interactive
  32.           interface is handled by xmonui. These two processes
  33.           communicate via a pipe from the standard output of xmonui to
  34.           the standard input of xmond.
  35.  
  36.           The following diagram shows the relationships between xmonui
  37.           and xmond, and the clients and the server.
  38.  
  39.                                     ----------
  40.                                     | xmonui |
  41.                                     ----------
  42.                                         |
  43.                                         v
  44.                ------------         ----------
  45.                | client 1 |<------->|        |
  46.                ------------         |        |       ----------
  47.                     :               | xmond  |<----->| server |
  48.                     :               |        |       ----------
  49.                ------------         |        |
  50.                | client n |<------->|        |
  51.                ------------         ----------
  52.                                         |
  53.                                         v
  54.                               monitor output to stdout
  55.  
  56.  
  57.           In the diagram the vertical connections are pipes and the
  58.           horizontal connections are normal X socket connections.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                           (printed 4/6/01)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  71.  
  72.  
  73.  
  74.           Xmond sits transparently between the X clients and an X
  75.           server.  To the clients it behaves just like an X server and
  76.           to the server it behaves just like a number of X clients.
  77.  
  78.      OOOOPPPPTTTTIIIIOOOONNNNSSSS TTTTOOOO XXXXMMMMOOOONNNNDDDD
  79.           ----sssseeeerrrrvvvveeeerrrr _d_i_s_p_l_a_y__n_a_m_e::::_d_i_s_p_l_a_y__n_u_m_b_e_r
  80.                This option sets the X display which xmond connects to.
  81.                _d_i_s_p_l_a_y__n_a_m_e can be a name or numerical network
  82.                address.  The default for both values is the value of
  83.                the DISPLAY environment variable. If this is not set,
  84.                then the default for _d_i_s_p_l_a_y__n_a_m_e is the local host and
  85.                the default for _d_i_s_p_l_a_y__n_u_m_b_e_r is 0.  If _d_i_s_p_l_a_y__n_u_m_b_e_r
  86.                is positive, the real port number is determined by
  87.                adding it to the base X server port number, 6000, just
  88.                as is done for standard X servers.  If it is negative,
  89.                the real port number is the absolute value of
  90.                _d_i_s_p_l_a_y__n_u_m_b_e_r.  A negative value may be useful when
  91.                using xmond as a general purpose tcp/ip monitor and the
  92.                byte stream being monitored does not obey the X
  93.                protocol.
  94.  
  95.           ----ppppoooorrrrtttt _d_i_s_p_l_a_y__n_u_m_b_e_r
  96.                This option sets the port on which xmond listens for
  97.                client connections. This port is always on the host
  98.                where xmond is running.  Default is 1.  The real port
  99.                number is determined in the same way as for the ----sssseeeerrrrvvvveeeerrrr
  100.                option.
  101.  
  102.           ----vvvveeeerrrrbbbboooosssseeee _v_e_r_b_o_s_e__l_e_v_e_l
  103.                This option sets the amount of output initially
  104.                produced by xmond for each request, reply, event or
  105.                error received.  The values are 0 (off), 1 (names), 2
  106.                (main), 3 (full), 4 (hex).  Default is 0.  The meaning
  107.                of each value is described in the USER INTERFACE
  108.                section.
  109.  
  110.           ----rrrraaaawwww If this option is given, xmond simply acts as a tcp/ip
  111.                monitor, passing bytes from one side to the other
  112.                without parsing the stream.  By default, it prints the
  113.                hexadecimal value of each byte passed.  This behaviour
  114.                may be altered by using the -ascii or -noprintraw
  115.                options.
  116.  
  117.           ----aaaasssscccciiiiiiii
  118.                If this option is given, dumps are printed as ascii
  119.                characters, except for unprintable characters, which
  120.                are printed as hexadecimal, escaped with a '\'.  This
  121.                is useful with the -raw option.
  122.  
  123.           ----nnnnoooopppprrrriiiinnnnttttrrrraaaawwww
  124.                If this option is given with the -raw option, xmond
  125.                does not print anything.
  126.  
  127.  
  128.  
  129.      Page 2                                           (printed 4/6/01)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  137.  
  138.  
  139.  
  140.           ----ppppaaaacccckkkkeeeetttt____ssssiiiizzzzeeee
  141.                If this option is given, xmond initially prints the
  142.                size of each block of data received from the clients
  143.                and server.
  144.  
  145.           ----rrrraaaawwww____ssssiiiizzzzeeee
  146.                Print size of traffic only.  Equivalent to "-
  147.                packet_size -raw -noprintraw".
  148.  
  149.      OOOOPPPPTTTTIIIIOOOONNNNSSSS TTTTOOOO XXXXMMMMOOOONNNNUUUUIIII
  150.           Xmonui accepts all of the standard X Toolkit command line
  151.           options.  In particular
  152.  
  153.           ----ddddiiiissssppppllllaaaayyyy _d_i_s_p_l_a_y__n_a_m_e::::_d_i_s_p_l_a_y__n_u_m_b_e_r
  154.                Indicates where to display the user interface window.
  155.  
  156.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  157.           1) To monitor connections made to the local host use the
  158.           following command line
  159.  
  160.           xmonui | xmond
  161.  
  162.           Connections made to the display _l_o_c_a_l_h_o_s_t:_1 will appear on
  163.           the display _l_o_c_a_l_h_o_s_t:_0.  The xmonui user interface will
  164.           appear on the display _l_o_c_a_l_h_o_s_t:_0.
  165.  
  166.           When starting up the application that you want to monitor,
  167.           be sure to set it's display correctly.  When you normally
  168.           start up an X application, and if you have not done anything
  169.           special, it will by default start up on display 0 of your
  170.           local host.  But xmon by default is listening as if it is
  171.           display 1 of your local host. Assuming your X application is
  172.           called "myclient" and your local host name is "dolphin" then
  173.           type the following to start up your application:
  174.  
  175.           myclient -display dolphin:1
  176.  
  177.           Another way to do the same thing is to change the DISPLAY
  178.           environment variable. If you are using a C shell you can do
  179.           this:
  180.  
  181.           setenv DISPLAY dolphin:1
  182.           myclient
  183.  
  184.           If you are not using a C shell, you may have to do something
  185.           different to change the DISPLAY environment variable.  Also,
  186.           most clients understand the -display option, but there are
  187.           those that do not.  To determine the name of your local host
  188.           try the _h_o_s_t_n_a_m_e command (although it may not be available
  189.           on all machines).
  190.  
  191.           2) If you are on the host _s_q_u_i_g_g_l_e which has two X servers
  192.  
  193.  
  194.  
  195.      Page 3                                           (printed 4/6/01)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  203.  
  204.  
  205.  
  206.           using the displays _s_q_u_i_g_g_l_e:_0 and _s_q_u_i_g_g_l_e:_1, and want to
  207.           monitor connections made to the server running on the
  208.           display _j_u_g_g_l_e_r:_0, enter the following command line.
  209.  
  210.           xmonui -display squiggle:0 | xmond -server juggler:0 -port 2
  211.  
  212.           Connections now made to the "display" _s_q_u_i_g_g_l_e:_2 will appear
  213.           on the display _j_u_g_g_l_e_r:_0.  The xmonui user interface will
  214.           appear on the display _s_q_u_i_g_g_l_e:_0.  Monitor output will
  215.           appear in the window where the command was entered.
  216.  
  217.           3) A good way to view the output of xmon is to pipe it
  218.           through xless, which allows you to scroll and search through
  219.           the output interactively.  For example:
  220.  
  221.           xmonui | xmond | xless -f
  222.  
  223.      TTTTHHHHEEEE UUUUSSSSEEEERRRR IIIINNNNTTTTEEEERRRRFFFFAAAACCCCEEEE
  224.           The user interface is divided into four parts: output
  225.           detail, statistics, selected requests and selected events.
  226.  
  227.           In the _o_u_t_p_u_t _d_e_t_a_i_l section, the amount of detail contained
  228.           in the output of xmon can be selected. Different levels of
  229.           detail can be selected for each of the message types:
  230.           requests, events, errors and replies.  The meaning of each
  231.           level is as follows.
  232.  
  233.           _o_f_f  No monitor output is produced.
  234.  
  235.           _n_a_m_e_s
  236.                Only the names of the messages are output.
  237.  
  238.           _m_a_i_n The most interesting fields of the message are output.
  239.  
  240.           _f_u_l_l All fields of the message are output.
  241.  
  242.           _h_e_x  All fields of the message are output, as well as a
  243.                hexadecimal dump.
  244.  
  245.           The detail setting for errors also applies to the following:
  246.           setup messages sent at client connection; the end-of-file
  247.           "message" sent at client shutdown; unknown extended
  248.           messages; and unexpected replies.  If xmon receives a
  249.           request, reply, event or error which it does not know how to
  250.           handle, and if the detail setting for errors is "hex", then
  251.           the message will be dumped in hexadecimal.  Similarly, if
  252.           xmon receives a reply for which it did not send a
  253.           corresponding request, and the detail setting for errors is
  254.           "hex", then the reply will be dumped in hexadecimal.
  255.  
  256.           Note that synthetic events (events sent by XSendEvent) are
  257.           monitored in the same way as normal events but are
  258.  
  259.  
  260.  
  261.      Page 4                                           (printed 4/6/01)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  269.  
  270.  
  271.  
  272.           identified as being "SYNTHETIC".
  273.  
  274.           Also in this section is the _s_h_o_w _p_a_c_k_e_t _s_i_z_e toggle. If this
  275.           is turned _o_n, xmon will display the size of each packet
  276.           received from both clients and servers. The file descriptor
  277.           of the client or server which sent the packet is also
  278.           displayed. The first client file descriptor is 4. File
  279.           descriptors 0, 1 and 2 are used by standard input, standard
  280.           output and standard error and file descriptor 3 is where
  281.           xmon listens for new connections.
  282.  
  283.           In the _s_t_a_t_i_s_t_i_c_s section, the counting of requests, events
  284.           and errors can be controlled as follows.
  285.  
  286.           _s_t_a_r_t
  287.                Enable the taking of statistics.
  288.  
  289.           _s_t_o_p Disable the taking of statistics.
  290.  
  291.           _c_l_e_a_r
  292.                Clear the counts for this message group.
  293.  
  294.           _p_r_i_n_t
  295.                Print the name and number of occurrences of each
  296.                message in this group, excluding messages received zero
  297.                times.
  298.  
  299.           _p_r_i_n_t _z_e_r_o
  300.                Print the names of messages in this group that have
  301.                been received zero times.
  302.  
  303.           In the _s_e_l_e_c_t_e_d _r_e_q_u_e_s_t_s section, selected requests can be
  304.           monitored at a different level of detail, or can be blocked
  305.           from transmission.  Requests can be selected by clicking on
  306.           their names in the scrollable list.  Clicking again de-
  307.           selects the request.  Selected requests are indicated by an
  308.           asterisk (*) in the scrollable list.
  309.  
  310.           The _d_e_t_a_i_l toggle is of the same form as in the _o_u_t_p_u_t
  311.           _d_e_t_a_i_l section, but applies only to those requests selected
  312.           in the left scrollable list.
  313.  
  314.           If the _b_l_o_c_k_i_n_g toggle in set to _o_n, all selected requests
  315.           in the right hand scrollable list are blocked by xmon.  They
  316.           are not forwarded to the server, although they are monitored
  317.           and counted normally.  If the _b_l_o_c_k_i_n_g toggle in set to _o_f_f,
  318.           all requests are forwarded to the server.
  319.  
  320.           The _s_e_l_e_c_t_e_d _e_v_e_n_t_s section is similar to the above section
  321.           but deals with events received from the server.
  322.  
  323.      UUUUSSSSIIIINNNNGGGG XXXXMMMMOOOONNNNDDDD WWWWIIIITTTTHHHHOOOOUUUUTTTT XXXXMMMMOOOONNNNUUUUIIII
  324.  
  325.  
  326.  
  327.      PPPPaaaaggggeeee 5555                                           ((((pppprrrriiiinnnntttteeeedddd 4444////6666////00001111))))
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  335.  
  336.  
  337.  
  338.           Normally xmonui is used as an interactive interface to
  339.           xmond. However, for some testing procedures it may be better
  340.           to run xmond by itself initialising it with some standard
  341.           setup.  The interface between xmonui and xmond is made up of
  342.           simple ascii strings.  Pressing buttons on xmonui causes it
  343.           to write these strings to standard output which are then
  344.           usually read by xmond.  You can just run xmond by itself and
  345.           type in the strings, or, even better, use a file as input to
  346.           xmond.  There are too many strings to list here, but if you
  347.           run xmonui by itself, you will see the strings being printed
  348.           to standard output.  Run
  349.  
  350.           xmonui > command.file
  351.  
  352.           to create a file of strings that can be used as input to
  353.           xmond.  For example, a file which will cause xmond to
  354.           monitor the Bell request and also print the names of all
  355.           events would contain the lines:
  356.  
  357.           monitor_request_on 104
  358.           event_verbose 1
  359.  
  360.           Running
  361.  
  362.           xmond < command.file
  363.  
  364.           will then set up xmond in the same way each time. Note that
  365.           when running xmond by itself, it does not exit on reading
  366.           end-of-file and so it must be killed. (I use CONTROL-C to
  367.           kill.  Your kill character may be different.)
  368.  
  369.           It is also possible to initialise xmond with a file, and
  370.           then take further commands from xmonui by running
  371.  
  372.           xmonui | cat command.file - | xmond
  373.  
  374.           The cat command first sends the command.file to xmond and
  375.           then passes the output of xmonui to xmond. Please note that
  376.           in this case xmonui will not show the new state of xmond
  377.           correctly.  For example, xmonui starts up assuming that no
  378.           requests have been selected, even if the command.file has
  379.           initialised xmond by selecting some requests.  This
  380.           inconsistency does not effect the usability of xmon but may
  381.           be confusing.
  382.  
  383.           The string
  384.  
  385.           quit
  386.  
  387.           will cause xmond to exit, so make sure that this does not
  388.           occur in any input file. Also it is meaningless to use the
  389.           statistics commands from within an input file because these
  390.  
  391.  
  392.  
  393.      Page 6                                           (printed 4/6/01)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  401.  
  402.  
  403.  
  404.           will be read before any X clients have connected.
  405.  
  406.      EEEEVVVVEEEENNNNTTTT RRRREEEECCCCOOOORRRRDDDDIIIINNNNGGGG AAAANNNNDDDD PPPPLLLLAAAAYYYYBBBBAAAACCCCKKKK
  407.           Xmon contains an unfinished attempt at event recording and
  408.           playback. It is fairly crude and does not work properly.  If
  409.           you are interested in exploring it and perhaps doing some
  410.           more work on it, please try it out.  To compile it in, you
  411.           will need to modify the Imakefile as suggested in the
  412.           comments.
  413.  
  414.           To try it out, first run xmond with the -record option and
  415.           with standard output redirected to a file.  The -record
  416.           option causes xmon to write, to standard output, a log of
  417.           all user events it receives. Run an X client through xmond
  418.           and interact with it.  The mouse and keyboard events will be
  419.           logged to the file.  Now kill that invocation of xmond.
  420.  
  421.           Now run xmond with the -play option and with standard input
  422.           redirected from the event log file just produced.  Now run
  423.           the same X client as before, but do not interact with it.
  424.           The client should receive events from xmond according to the
  425.           log file and behave in the same way as before.
  426.  
  427.           The events are played back at the same speed as when
  428.           recorded (thanks to code contributed by Marc Vertes).  The
  429.           algorithm used to decide when the client is ready to receive
  430.           the next event is faulty and can sometimes wait forever.  It
  431.           simply counts the number of ImageText8 and PolyText8
  432.           requests that are received and records the counts with each
  433.           event in the log file.  During replay, an event is sent to
  434.           the client when the matching number of requests have been
  435.           received.
  436.  
  437.           For example, to record and playback a simple xterm session:
  438.             xmond -record > foo
  439.             (then run xterm through it, typing a few commands)
  440.             (exit xterm and kill xmond)
  441.             xmond -play < foo
  442.             (now run xterm through it again)
  443.           It half works.  Good luck.
  444.  
  445.      BBBBUUUUGGGGSSSS
  446.           No provision is included for extensions to the base
  447.           protocol.
  448.  
  449.           Xmon only handles TCP socket connections.  UNIX domain
  450.           sockets and DECnet are not supported.
  451.  
  452.           There should be a better way of initialising the state of
  453.           xmond and having this new state reflected in xmonui.
  454.  
  455.           Because of the security method used by your X server, it may
  456.  
  457.  
  458.  
  459.      Page 7                                           (printed 4/6/01)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      xxxxmmmmoooonnnn((((1111))))           XXXX VVVVeeeerrrrssssiiiioooonnnn 11111111 ((((33330000 MMMMaaaarrrrcccchhhh 1111999999996666))))            xxxxmmmmoooonnnn((((1111))))
  467.  
  468.  
  469.  
  470.           reject connection attempts made by xmond.  A work-around is
  471.           to run
  472.  
  473.           xhost +
  474.  
  475.           to force the X server to accept all connections.
  476.  
  477.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  478.           X(1)
  479.  
  480.           X Window System Protocol, MIT X Consortium Standard, X
  481.           Version 11, Release 4, by Robert W. Scheifler.
  482.  
  483.      AAAAUUUUTTTTHHHHOOOORRRRSSSS
  484.           Greg McFarlane, OTC, Australia, from the xscope program
  485.           written by James L Peterson, MCC.
  486.  
  487.           Please send any bug reports or modifications to
  488.  
  489.               gregm@iname.com
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.      Page 8                                           (printed 4/6/01)
  526.  
  527.  
  528.  
  529.